package api

import (
	"github.com/gin-gonic/gin"
	"zg3/developer-branch/api/handler"
	"zg3/developer-branch/consts"
	"zg3/developer-branch/pkg"
)

func LoadRouter(r *gin.Engine) {

	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/login", handler.UserLogin)
		}
		chat := api.Group("/chat")
		{
			chat.Use(pkg.JWTAuth(consts.JWT_App_Key))
			chat.GET("/ws", handler.WsChat)
			chat.GET("/query-history", handler.QueryHistory)
		}
		room := api.Group("/room")
		{
			room.Use(pkg.JWTAuth(consts.JWT_App_Key))
			room.POST("/create", handler.CreateRoom)
			room.POST("/add-user", handler.AddRoomUser)
		}
	}

}
